<template>
  <div>
    <!--1视图-->
    <el-table
        :data="tableData"
        style="width: 100%">
      <el-table-column
          fixed
          label="日志编号"
          prop="id"
          width="150">
      </el-table-column>
      <el-table-column
          label="用户名"
          prop="username"
          width="150">
      </el-table-column>
      <el-table-column
          label="ip地址"
          prop="ip"
          width="150">
      </el-table-column>
      <el-table-column
          label="角色id"
          prop="roleId"
          width="150">
      </el-table-column>
      <el-table-column
          label="创建时间"
          prop="createDate"
          width="230">
      </el-table-column>
      <el-table-column
          fixed="right"
          label="操作"
          width="220">
        <template slot-scope="scope">
          <el-button size="small" type="text" @click="show(scope.row)">
            <span style="color: #7babff;font-size: 20px">
            <i class="el-icon-share"></i>
            </span>
          </el-button>
          <el-button size="small" type="text" @click="show(scope.row)">
            <span style="color: #2972ff;font-size: 20px">
            <i class="el-icon-menu"></i>
            </span>
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
        :current-page.sync="current"
        :page-size="size"
        :total="total"
        layout="total, prev, pager, next"
        @current-change="goPage">
    </el-pagination>

  </div>

</template>

<script>
export default {
  name: "LogsView",
  data() {
    return {
      tableData: [],
      current: 1,
      size: 5,
      total: 0,
      //2属性定义
    }
  }, methods: {
    goPage(current) {
      this.current = current;
      this.list();
    },
    list() {
      this.axios.post("userservice/logs/list?current=" + this.current + "&size=" + this.size).then(res => {
        this.tableData = res.data.data.list;
        this.total = res.data.data.total;
      })
    },
    //3自定义方法

  }, created() {
    this.list();
    //4.钩子函数
  }
}
</script>

<style scoped>

</style>